package com.gzbsoft.sc.modules.sys.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.ebean.annotation.DbComment;
import io.ebean.annotation.DocEmbedded;
import io.ebean.annotation.DocStore;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;
@DocStore
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "jx_good_sku")
@Data
@DbComment("商品SKU表")
public class JxGoodSku extends BaseEntity {
    @DocEmbedded(doc = "id, title")
    @JsonIgnore
    @DbComment("商品id")
    @ManyToOne
    @JoinColumn(name = "jx_good_id")
    private JxGood good;
    @DbComment("型号")
    private String name;
    @DbComment("库存")
    private Integer remain;
    @DbComment("价格")
    private BigDecimal price;
    @DocEmbedded
    @DbComment("技术参数")
    @OneToOne
    @JoinColumn(name = "jx_good_standard_id")
    private JxGoodStandardDetail standard;
    @DocEmbedded
    @DbComment("配置参数")
    @OneToOne
    @JoinColumn(name = "jx_good_specs_id")
    private JxGoodSpecsDetail specs;
    @Override
    public String toString() {
        return "JxGoodSku{" +
                "good=" + good +
                ", name='" + name + '\'' +
                ", remain=" + remain +
                ", price=" + price +
                ", standard=" + standard +
                ", specs=" + specs +
                ", id=" + id +
                '}';
    }
}
